package com.qk.mapper;

import com.qk.entity.Course;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CourseMapper {
    List<Course> selectAll(String name, Integer subject, Integer target);
    @Delete("delete from course where id=#{id}")
    void deleteById(Integer id);
    @Insert("insert into course(subject, name, price, target, description, create_time, update_time) values(#{subject},#{name},#{price},#{target},#{description},#{createTime},#{updateTime})")
    void add(Course  course);
    @Select("select id, subject, name, price, target, description, create_time, update_time from course where id=#{id}")
    Course findById(Integer id);
    //@Update("update course set subject=#{subject},name=#{name},price=#{price},target=#{target},description=#{description},upate_time=#{updateTime}")
    void update2(Course course);
    @Select("select id, subject, name, price, target, description, create_time, update_time from course")
    List<Course> listCourse();
    @Select("select *from course where subject=#{subject}")
    List<Course> findBySubject(Integer subject);
}
